package com.google.jgib.main;

import java.io.IOException;

import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;

import com.google.code.jgib.growl.requests.GntpNotificationRequest;
import com.google.code.jgib.growl.requests.GntpNotificationRequest.NotificationType;
import com.google.code.jgib.growl.requests.GntpRegisterRequest;
import com.google.jgib.util.irc.IrcBot;

public class JGIb {
	public static final boolean DEBUG = true;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if(args.length != 7 && !DEBUG){
			System.out.println("Invalid number of arguments.\nExpected: java -jar jgib.jar <bindIP> <bindPort> <sendToIP> <sendToPort> <IRCServer> <IRCServPort> <IRCFlags>");
			System.exit(0);
		}
		if(!DEBUG){
			GntpRegisterRequest gntpRegister = new GntpRegisterRequest();
			gntpRegister.doRegister(args[2], Integer.parseInt(args[3]));
		}else{
			GntpRegisterRequest gntpRegister = new GntpRegisterRequest();
			gntpRegister.doRegister("localhost", 23053);
			
			IrcBot bot = new IrcBot("WargGrowler", "localhost", 23053);
			try {
				bot.connect("goatse.fef.net");
				bot.joinChannel("#thepretender");

			} catch (NickAlreadyInUseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IrcException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			
		}


	}

}
